
/**
copyright:Developer's work team
version:1.0
author:duck
time:2009-07-03
*/
/**
json decode util
*/
Jsondecoder=function(){}
Jsondecoder.decode=function(jsonString){
		return eval('('+jsonString+')');
}
/**
CommonUtil used for web developemnt

*/
Util=function(){};
Util.each=function( obj, fn, args ) { 
    if ( args ) { 
       if ( obj.length == undefined ){ 
           for ( var i in obj ) 
             fn.apply( obj, args ); 
       }else{ 
           for ( var i = 0, ol = obj.length; i < ol; i++ ) {
              if ( fn.apply( obj, args ) === false ) 
                  break; 

          }

       }
   } else { 
       if ( obj.length == undefined ) {
            for ( var i in obj ) 
               fn.call( obj, i, obj ); 
       }else{ 
          for ( var i = 0, ol = obj.length, val = obj[0]; i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){} 

       }
  } 
  return obj; 
}  


Util.$=function(id){
	return document.getElementById(id);
}

Util.getAllByDocument=function(){
	var all=[];
	for(var i=0;i<document.all.length;i++){
		all.push(document.all[i]);
	}
	return all;
}
Util.getAllByForm=function(form){
	var childs=document.all[form];
	var all=[];
	for(var i=0;i<childs.length;i++){
		all.push(childs[i]);
	}
	return all;
}
Util.$$=function(father,tag){
	
	var childs=$(father).childNodes;
	var array=new Array();
		for(var i=0;i<childs.length;i++){
			if(childs[i].type==tag){
				array.push(childs[i]);
			}
		}
	return array;
}




